<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="<s:url value="/assets/web/css/base.css"></s:url>"><!-- 基本框css -->
    <link rel="stylesheet" href="<s:url value="/assets/web/css/login/bootstrap.min.css?v=3.3.6"></s:url>">
    <link rel="stylesheet" href="<s:url value="/assets/web/css/base_nav.css"></s:url>">

    <link rel="stylesheet" href="<s:url value="/assets/web/css/user/projectInfo.css"></s:url>">
    <title>配置节点</title>
    <style>
        .authority {
            display: none;
        }

        /* 显示区域边距 */
        #content-main {
            padding: 10px 0px 0;
        }

        .child1 {
            top: 3px;
            left: 3px;
        }

        /*菜单修改*/
        /*.nav-left {*/
        /*top: 47px;*/
        /*}*/
        /*修改按钮*/
        .modal-header {
            position: relative;
        }

        .module-node-name {
            font-size: 16px;
            position: absolute;
            top: 95px;
            left: 50px;
        }

        .module-node-name > p {
            margin-bottom: 45px;
        }

        .div-input {
            margin-bottom: 15px;
            font-size: 16px;
            color: black;
        }

        .div-input > input {
            width: 300px;
            height: 50px;
            padding: 0 10px;
        }

        .div-input > select {
            width: 300px;
            height: 50px;
            padding: 0 10px;
        }

        /*下拉列表*/
        .clear-list > li:first-child {
            margin-left: 35px;
        }

        .clear-list > li:nth-child(2) {
            position: absolute;
            top: 0;
            left: 18%;
        }

        .clear-list > li:nth-child(3) {
            position: absolute;
            top: 0;
            left: 35%;
        }

        .clear-list > li:nth-child(4) {
            position: absolute;
            top: -3px;;
            left: 49%;

        }

        .clear-list > li:nth-child(5) {
            position: absolute;
            top: -3px;;
            left: 60%;

        }

        .clear-list > li:nth-child(6) {
            position: absolute;
            top: -3px;;
            left: 75%;
        }

        /*修改按钮*/
        .clear-list > li:nth-child(7) {
            position: absolute;
            left: 90%;
            /*display: inline-block;*/
            margin: 0 10px;
            width: 60px;
            height: 30px;
            background: #337ab7;
            color: #ffffff;
            border-radius: 5px;
            font-size: 13px;
            text-align: center;
            line-height: 30px;
            cursor: pointer;
        }

        .button_css {
            /*position: absolute;*/
            /*left: 85%;*/
            float: right;
            margin: -7px 20px;
            height: 30px;
            border-radius: 5px;
            font-size: 13px;
            text-align: center;
            line-height: 30px;
            cursor: pointer;
        }

        .left_css {
            position: absolute;
            left: 76%;
            margin-top: 7px;
        }

        .jd-block {
            width: 100%;
        }

        /*实际完成时间*/
        .actual-times {
            /*position: absolute;*/
            /*left: 70%;*/
            float: right;
            display: inline-block;
            margin-top: -4px;
        }

        .jd-block .update {
            /*display: inline-block;*/
            margin: 0 10px;
            width: 60px;
            height: 30px;
            background: #337ab7;
            color: #ffffff;
            border-radius: 5px;
            font-size: 13px;
            text-align: center;
            line-height: 30px;
            cursor: pointer;
        }

        .total-title {
            font-size: 17px;
            margin-left: 30px;
            margin-right: 20px;
        }

        .drop-list .open + ul {
            height: 150px;
        }

        .clear-list > li:nth-child(8), .clear-list > li:nth-child(10) {
            margin-left: -71px;
            margin-top: 45px;
        }

        /*.clear-list > li:nth-child(8){*/
            /*margin-left: -83px;*/
        /*}*/

        .clear-list > li:nth-child(9), .clear-list > li:nth-child(11) {
            position: absolute;
            top: 31px;
            left: 18%;
        }

        .clear-list > li:nth-child(10), .clear-list > li:nth-child(12) {
            position: absolute;
            top: 0px;
            left: 40%;
        }
        .clear-list > li:nth-child(11), .clear-list > li:nth-child(13) {
            position: absolute;
            top: 0px;
            left: 40%;
        }
        .clear-list > li:nth-child(12){
            position: absolute;
            top: 30px;
            left: 35%;
        }

        .resptUnit {
            cursor: pointer;
            color: rgba(46, 123, 228, 1);
        }
    </style>
</head>

<body class="bgcolor">
<%@ include file="/WEB-INF/views/modules/commons/nav.jsp" %>
<%@ include file="/WEB-INF/views/modules/commons/menu.jsp" %>
<table></table>
<!-- 窗口显示区 -->
<div class="av row J_mainContent" id="content-main">
    <div class="container" style="width: 97%;">
        <%--通不通过模态框--%>
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
             aria-hidden="true">
            <%--确认通过--%>
            <div class="modal-dialog  through-or-no-1">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" style="text-align: center;">确认该项目通过吗？</h4>
                    </div>
                    <div class="modal-footer" id="passY">
                        <form role="form" action="<s:url value="/projectManger/pass"></s:url>">
                            <input type="text" class="sysid" name="sysId" placeholder="" style="display: none">
                            <button type="submit" class="btn btn-primary">确认</button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        </form>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
            <%--不通过--%>
            <div class="modal-dialog  through-or-no-2">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" style="text-align: center;">确认该项目不能通过吗？</h4>
                    </div>
                    <div class="modal-footer" id="passN">
                        <form role="form" action="<s:url value="/projectManger/noPass"></s:url>">
                            <input type="text" class="sysid" name="sysId" placeholder="" style="display: none">
                            <button type="submit" class="btn btn-primary">确认</button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        </form>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
        <%--配置节点信息--%>
        <div class="config">
            <%--<p class="config-nav">--%>
            <%--<span>--%>
            <%--<a href="#">首页</a>&nbsp;&gt;&nbsp;--%>
            <%--</span>--%>
            <%--<span>--%>
            <%--<a href="#">创建新项目</a>&nbsp;&gt;&nbsp;--%>
            <%--</span>--%>
            <%--<span>--%>
            <%--<a href="#">配置项目节点</a>&nbsp;&gt;&nbsp;--%>
            <%--</span>--%>
            <%--</p>--%>
            <div class="config-title">
                <p>
                    <span>项目名称 :</span>
                    <span>${projectList.name}</span>
                </p>
                <p>
                    <span>项目状态 :</span>
                    <span>${projectList.status == "1" ? "待审批部门确认节点" :
                            projectList.status == "2" ? "未审核":
                                    projectList.status == "3" ? "项目进行中":
                                            projectList.status == "4" ? "已完成":
                                                    projectList.status == "5" ? "审核不通过，请重新配置节点信息": "项目已暂停"}</span>
                </p>
                <p>
                    <span>责任单位 :</span>
                    <span class="resptUnit">${projectList.resDept}</span>
                </p>
                <p class="hide-content">
                    <span>项目联系人 : </span>
                    <span>${projectList.contactName}</span>
                </p>
                <p class="hide-content">
                    <span>分管领导 : </span>
                    <span>${projectList.resUser}</span>
                </p>
                <p class="hide-content">
                    <span>征迁实施单位 : </span>
                    <span>${projectList.occupyDept}</span>
                </p>
                <p class="hide-content">
                    <span>征迁责任人 : </span>
                    <span>${projectList.occupyResUser}</span>
                </p>
                <p class="hide-content">
                    <span>征迁经办人 : </span>
                    <span>${projectList.occupyOperateUser}</span>
                </p>
                <p class="hide-content">
                    <span>计划投资总额(万) : </span>
                    <span>${projectList.money}</span>
                </p>
                <p class="hide-content">
                    <span>初步选址 : </span>
                    <span>${projectList.address}</span>
                </p>
                <p class="hide-content">
                    <span>行业类型 : </span>
                    <span>${projectList.natureType == '0' ? '政府投资类' : projectList.natureType == '1' ? '企业投资类' :
                            projectList.natureType =='2'?'土地收储类':projectList.natureType =='3'? '政府投资房建市政类' :
                                    '政府投资交通水利类'}</span>
                </p>
                <p class="hide-content">
                    <span>建设内容 : </span>
                    <span>${projectList.describes }</span>
                </p>
                <p class="open-list">展开更多信息 v</p>
            </div>
            <%--通过或不通过的按钮--%>
            <c:if test="${projectList.status == 2}">

                <p class="throug-button">
                    <span class="through" data-sysId="${projectList.sysId}" data-toggle="modal" data-target="#myModal">通过</span>
                    <span class="no-through" data-sysId="${projectList.sysId}" data-toggle="modal"
                          data-target="#myModal">不通过</span>
                </p>
            </c:if>
            <%--表格--表格--%>
            <c:if test="${projectList.status == 0 || projectList.status == 1}">
                <div class="table-tb">
                    <table class="project-info" border="0">
                        <thead>
                        <tr>
                            <th>节点名称</th>
                            <th>审核部门</th>
                            <th>创建时间</th>
                            <th>审核状态</th>
                            <th>审核时间</th>
                        </tr>
                        </thead>
                        <c:forEach var="list" items="${nodeList}">
                            <c:if test="${list.type == '1'}">
                                <tbody>
                                <tr>
                                    <td>${list.nodeId} ${list.nodeName}</td>
                                    <td>${list.resDept}</td>
                                    <td>${list.createDate}</td>
                                    <td>${list.state == '1' ? '部门需要' : list.state=='2' ? '部门不需要' : list.state=='3'?'业主已配置' :'未确定'}</td>
                                    <td>${list.updDate}</td>
                                </tr>
                                </tbody>
                            </c:if>
                        </c:forEach>
                    </table>
                </div>
            </c:if>
            <!-- 项目建议书 -->
            <c:if test="${projectList.status != 0 || projectList.status != 1}">


                <div class="config-content">
                    <div class="jd-block">
                        <div style="margin: 5px 0 !important;">
                            <i style="font-size: 20px; color: red;"></i>
                            <span class="total-title">&#8226 未完成节点总共${noFinishNodeNum}个,(${strBufNoFinish})-计划用时:${planUseTime}天;</span>
                        </div>
                        <div style="margin: 5px 0 !important;">
                            <i style="font-size: 20px; color: red;"></i>
                            <span class="total-title">&#8226 进行中节点总共${doingNodeNum}个,(${strBufBegin})-计划用时:${planTimeInBegin}天;</span>
                        </div>
                        <div style="margin: 5px 0 !important;">
                            <i style="font-size: 20px; color: red;"></i>
                            <span class="total-title">&#8226 已完成节点总共${finishedNodeNum}个,(${strBufFinish})-实际用时:${factUseTime}天。</span>
                        </div>
                        <div style="margin: 5px 0 !important;">
                            <i style="font-size: 20px; color: red;"></i>
                            <span class="total-title">&#8226 所有节点（已完成、未完成、进行中）计划用时:${planUseTimeAll}天;</span>
                        </div>
                        <div style="margin: 5px 0 !important;">
                            <i style="font-size: 20px; color: red;"></i>
                            <span class="total-title">&#8226 所有节点（已完成、未完成、进行中）实际用时:${factUseTimeAll}天;</span>
                        </div>
                        <div style="margin: 5px 0 !important;">
                            <i style="font-size: 20px; color: red;"></i>
                            <span class="total-title">&#8226 总共进行过&nbsp;【<a href="/projectManger/queryNode?sysId=${sysId}&supervisionFlag=true">${supervisionCount}次</a>】&nbsp;督查;</span>
                            <span class="total-title">【<a href="/projectManger/queryNode?sysId=${sysId}">查看所有节点</a>】</span>
                        </div>
                        <div style="margin: 5px 0 !important;">
                            <i style="font-size: 20px; color: red;"></i>
                            <c:if test="${!empty taskNodes}">
                                <span class="total-title">&#8226 进入督查的节点有:&nbsp;&nbsp;${taskNodes}。</span>
                            </c:if>
                            <c:if test="${empty taskNodes}">
                                <span class="total-title">&#8226 目前没有节点进入督查。</span>
                            </c:if>
                        </div>
                    </div>
                    <div id = "nodeDetail_div">
                        <c:forEach var="list" items="${nodeList}">
                            <div class="jd-block">
                                <c:if test="${list.type == '1'}">
                                    <div class="element1 left">
                                        <div class="child1"></div>
                                    </div>
                                    <span class="total-title">${list.nodeId} ${list.nodeName}</span>
                                    <span style=" margin-rigt:40px">
                                    计划用时:<em>${list.planTime}天</em>
                                </span>
                                    <span style=" margin-rigt:40px">
                                    实际用时:<em>${list.factTime}天</em>
                                </span>
                                    <%--<c:if test="${projectList.status != 3}">--%>
                                    <%--<em class="left_css">节点状态：${list.state == '1' ? '部门需要' : list.state=='2' ? '部门不需要' : list.state=='3'?'业主已配置' :'未确定'}</em>--%>
                                    <%--</c:if>--%>
                                    <%--<c:if test="${projectList.status != 3}">--%>

                                    <%--大节点修改时间的功能去掉，取消大节点处的修改功能--%>
                                    <%--<span class="update" style="float: right;" data-nodeId="${list.nodeId}"--%>
                                    <%--data-title="${list.nodeId} ${list.nodeName}" data-toggle="modal"--%>
                                    <%--data-target="#myModal-update">修改--%>
                                    <%--</span>--%>
                                    <div class="btn-group  button_css authority">
                                        <button type="button" class="btn btn-default dropdown-toggle"
                                                data-toggle="dropdown">
                                            &nbsp;
                                            <c:if test="${list.state == 2}">
                                                状态:不需要(点击可修改)
                                            </c:if>
                                            <c:if test="${list.state != 2}">
                                                状态:需要(点击可修改)
                                            </c:if>
                                            &nbsp;<span class="caret"></span>
                                        </button>
                                        <ul class="dropdown-menu department-need" role="menu" style="left:20px;">
                                                <%--<li data-status="1" data-projectid="${list.projectId}" data-nodeid="${list.nodeId}"><a href="javascript:void(0);">确认需要</a></li>--%>
                                            <li data-status="2" data-projectid="${list.projectId}"
                                                data-nodeid="${list.nodeId}"><a href="javascript:void(0);">确认不需要</a>
                                            </li>
                                            <li data-status="1" data-projectid="${list.projectId}"
                                                data-nodeid="${list.nodeId}"><a href="javascript:void(0);">确认需要</a>
                                            </li>
                                        </ul>
                                    </div>
                                    <%--</c:if>--%>
                                    <div class="actual-times">
                                    <span class="actual-completion-time">
                                            <c:if test="${list.planBeginDate != null}">
                                                开始时间：${list.planBeginDate}
                                            </c:if>
                                            <c:if test="${list.planBeginDate == null}">
                                                计划开始时间：${list.planBeginTime}
                                            </c:if>
                                            </span>&nbsp;&nbsp;
                                        <span class="actual-completion-time">实际完成时间：
                                            <c:if test="${list.factFinishDate == null}">
                                                暂无
                                            </c:if>
                                            <c:if test="${list.factFinishDate != null}">
                                                ${list.factFinishDate}
                                            </c:if>
                                            </span>&nbsp;&nbsp;
                                        <button data-nodeid="${list.nodeId}" data-projectid="${list.projectId}"
                                                class="update-time btn  btn-sm  btn-primary authority">更新时间
                                        </button>
                                    </div>
                                </c:if>
                                <c:if test="${list.type == '2'}">
                                <ul class="drop-list">
                                    <li>
                                    <span class="open">${list.nodeId} ${list.nodeName}&nbsp;&nbsp;&nbsp;
                                        <em>∧</em>
                                    </span>
                                        <ul class="clear-list">
                                            <li>
                                                状态：
                                                <c:if test="${list.isDelay == -1}">
                                                    <em>未完成</em>
                                                </c:if>
                                                <c:if test="${list.isDelay == 0}">
                                                    <em>正常</em>
                                                </c:if>
                                                <c:if test="${list.isDelay == 1}">
                                                    <em>逾期</em>
                                                </c:if>
                                                <c:if test="${list.isDelay == 2}">
                                                    <em>超前</em>
                                                </c:if>
                                            </li>
                                            <li>
                                                负责人：
                                                <em>${list.resUser}</em>
                                            </li>
                                            <li>
                                                经办人：
                                                <em>${list.operatorUser}</em>
                                            </li>
                                            <li>
                                                计划用时：
                                                <em>${list.planTime}天</em>
                                            </li>
                                            <li>
                                                实际用时：
                                                <em>${list.factTime}天</em>
                                            </li>
                                            <li>
                                                <c:if test="${projectList.status != 3 && projectList.status!=4 && projectList.status!=6}">
                                                    <em style="background: transparent;
                                                text-decoration: none;
                                                color: #900b09;
                                                border-bottom: 1px solid #900b09;">${list.state == '1' ? '部门需要' : list.state=='2' ? '部门不需要' : list.state=='3'?'业主已配置' :'未确定'}</em>
                                                </c:if>
                                                <c:if test="${projectList.status == 3 || projectList.status == 4 || projectList.status==6}">
                                                    <em>${list.status == "0" ? "未开始" : list.status=='1'? '开始':list.status==2?'结束':"暂停"}</em>
                                                </c:if>
                                            </li>
                                                <%--修改按钮--%>
                                            <li class="update authority" data-nodeId="${list.nodeId}"
                                                data-title="${list.nodeId} ${list.nodeName}" data-toggle="modal"
                                                data-target="#myModal-update">修改
                                            </li>
                                            <c:if test="${list.status == '2'}">
                                                <c:if test="${list.planBeginDate != null}">
                                                    <li>
                                                        实际开始时间:
                                                        <em>${list.planBeginDate}</em>
                                                    </li>
                                                </c:if>
                                                <c:if test="${list.factFinishDate != null}">
                                                    <li>
                                                        实际结束时间:
                                                        <em>${list.factFinishDate}</em>
                                                    </li>
                                                </c:if>
                                            </c:if>
                                            <c:if test="${list.status == '1'}">
                                                <c:if test="${list.planBeginDate != null}">
                                                    <li style="margin-left: -83px;">
                                                        实际开始时间:
                                                        <em>${list.planBeginDate}</em>
                                                    </li>
                                                    <li>

                                                    </li>
                                                </c:if>
                                                <c:if test="${list.planBeginTime != null}">
                                                    <li>
                                                        计划结束时间:
                                                        <em>${list.planEndTime}</em>
                                                    </li>
                                                </c:if>
                                            </c:if>
                                            <c:if test="${list.status == '0'}">
                                                <c:if test="${list.planBeginTime != null}">
                                                    <li style="margin-left: -83px;">
                                                        计划开始时间:
                                                        <em>${list.planBeginTime}</em>
                                                    </li>
                                                </c:if>
                                                <c:if test="${list.planBeginTime != null}">
                                                    <li>
                                                        计划结束时间:
                                                        <em>${list.planEndTime}</em>
                                                    </li>
                                                </c:if>
                                            </c:if>
                                            <li style=" position: absolute;top: 34px;left: 0; margin-left: 35px;">
                                                上个节点:
                                                <em>${list.preNodeId}</em>
                                            </li>
                                            <li style=" position: absolute;left: 0;top: 100px;margin-left: 35px;">
                                                下个节点:
                                                <em>${list.nextNodes}</em>
                                            </li>
                                                <%--进入督查--%>
                                            <c:if test="${list.taskId != null}">
                                                <li style="font-weight: bold;">
                                                    <div class="badge  pull-left reds"
                                                         style="background-color: #d15b47 !important;">!
                                                    </div>
                                                    &nbsp;&nbsp;该节点已&nbsp;<a
                                                        href="/missions?taskId=${list.taskId}">进入督查</a>&nbsp;(督查${list.taskTimes}次)
                                                </li>
                                            </c:if>
                                        </ul>
                                    </li>
                                    </c:if>
                                </ul>
                            </div>
                        </c:forEach>
                    </div>
                </div>
            </c:if>

            <!-- 提交、修改按钮 -->
            <div class="button-list">
                <!-- <a class="submit" href="#">确定</a> -->
                <%--<a class="revise" href="#">返回修改</a>--%>
            </div>
        </div>
    </div>
</div>
<%--修改模态框--%>
<div class="modal fade" id="myModal-update" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <p class="node-title" style="display: inline-block;font-size: 20px;font-weight: bold; margin: 0;"></p>
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <div class="module-node-name">
                    <p>实际开始时间</p>
                    <p>实际结束时间</p>
                    <p>计划用时</p>
                    <p>实际用时</p>
                    <p>节点状态</p>
                    <p>节点是否需要</p>
                </div>
            </div>
            <form action="">
                <div class="modal-body text-center">
                    <div class="div-input">
                        <input name="planBeginDate" class="plan-start-time" type="text" id="J-xl-1">
                    </div>
                    <div class="div-input">
                        <input name="factEndDate" class="finish-time" type="text" id="J-xl-2">
                    </div>
                    <div class="div-input">
                        <input name="planTime" id="planTime" class="plan-time" type="number" min="0">
                    </div>
                    <div class="div-input">
                        <input name="factTime" id="factTime" class="actual-time" type="number" readOnly="true">
                    </div>
                    <div class="div-input">
                        <select name="status" id="status" class="node-status">
                            <option value="">未知</option>
                            <option value="0">未开始</option>
                            <option value="1">已开始</option>
                            <option value="2">结束</option>
                        </select>
                    </div>
                    <div class="div-input">
                        <select name="state" id="state" class="node-state">
                            <option value="0">未确定</option>
                            <option value="1">需要</option>
                            <option value="2">不需要</option>
                        </select>
                    </div>
                    <input hidden type="text" id="sysId" name="sysId" class="node-stysid">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" id="sub">提交更改</button>
                </div>
            </form>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<input class="update-manger" hidden type="text" value="${projectList.sysId}">
<%--需不需要确认--%>


<script src="<s:url value="/assets/web/js/jquery.min.js"></s:url>"></script>
<script src="<s:url value="/assets/web/js/bootstrap.min.js"></s:url>"></script>
<script src="<s:url value="/assets/web/js/baseAPI.js"></s:url>"></script>
<script src="<s:url value="/assets/web/common/bootstrapvalidator/dist/js/bootstrapValidator.js"></s:url>"></script>
<%--日期插件--%>
<script src="<s:url value="/assets/web/common/date/laydate.dev.js"></s:url>"></script>

<script src="<s:url value="/assets/web/js/md5.js"></s:url>"></script>
<script>
    $(function () {

        //用户角色类型
        var branchType = "${branchType}";

        //更新大节点实际完成时间
        $(".update-time").click(function () {
            var projectId = $(this).data("projectid");
            var nodeId = $(this).data("nodeid");
            $.ajax({
                type: "POST",
                url: "/accraditation/updateBigNodeFinishTime",
                dataType: "json",
                data: {
                    projectId: projectId,
                    nodeId: nodeId
                },
                success: function (result) {
                    if (result.res == true) {
                        alert(result.msg);

                        location.reload();
                    } else if (result.res == false) {
                        alert(result.msg);
                    }

                },
                error: function (res) {

                }
            })
        })


        //    修改节点
        $("#sub").click(function () {
            var planBeginDate = $("#J-xl-1").val();
            var factEndDate = $("#J-xl-2").val();
            var planTime = $("#planTime").val();
            var factTime = $("#factTime").val();
            var status = $("#status").val();
            var sysId = $("#sysId").val();
            var state = $("#state").val();
            // if(!planBeginDate.match(/^((?:19|20)\d\d)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/)) {
            //     alert('日期错误');
            //     return false;
            // }else if(planBeginDate == ""){
            //     if(status == "2"){
            //         alert('节点状态异常,请重新选择');
            //     }
            // }else if(factEndDate == ""){
            //     if(status == "2"){
            //         alert('节点状态异常,请重新选择');
            //     }
            // }
            // var flag = factTime - planTime;

            $.ajax({
                type: "POST",
                url: "/node/editNodeTimeInfo",
                dataType: "json",
                data: {
                    planBeginDate: planBeginDate,
                    factEndDate: factEndDate,
                    planTime: planTime,
                    factTime: factTime,
                    sysId: sysId,
                    status: status,
                    state: state
                },
                success: function (res) {
                    if (res.code == '200') {
                        alert("更新成功");
                        location.reload();
                    } else if (res.code == '500') {
                        alert("更新失败," + res.msg);
                    }

                },
                error: function (res) {

                }
            })


        });

        //确认部门是否需要
        $(".department-need").on("click", "li", function () {
            var state = $(this).data("status");
            var projectId = $(this).data("projectid");
            var nodeid = $(this).data("nodeid");

            $.ajax({
                type: "POST",
                url: "/accraditation/configBigNode",
                dataType: "json",
                data: {
                    state: state,
                    projectId: projectId,
                    nodeId: nodeid
                },
                success: function (res) {
                    console.log(res);
                    window.location.reload();

                }
            })
        });


        /*
        * 提交修改
        * */
        // $("#sub").click(function () {
        //     $("#frm-reg").ajaxSubmit(function (data) {
        //         alert(data.Message);
        //     });
        // });

        /*
        * 修改
        * */
        $(".jd-block").on("click", ".update", function () {
            //获取参数
            var projectId = $(".update-manger").val();
            var nodeId = $(this).data("nodeid");

            var nodetitle = $(this).data("title");

            $(".node-title").html(nodetitle);

            $.ajax({
                url: '/node/getsmallnodeinfo',
                type: 'GET',
                data: {projectId: projectId, nodeId: nodeId},
                dataType: "json",
                success: function (result) {
                    console.log(result);
                    $(".plan-start-time").val(result.planBeginDate); //计划开始时间
                    $(".finish-time").val(result.factEndDate);        //实际结束时间
                    $(".plan-time").val(result.planTime);           //计划用时
                    $(".actual-time").val(result.factTime);           //实际用时
                    $("#status").val(result.status);
                    $("#state").val(result.state);

                    var ops = $(".node-status>option");                //节点状态
                    for (var i = 0; i < ops.length; i++) {
                        if (ops[i].value == result.status) {
                            ops[i].setAttribute("selected", "true");
                        } else {
                            ops[i].removeAttribute("selected");
                        }
                    }
                    var opss = $(".node-state>option");
                    for (var i = 0; i < opss.length; i++) {
                        if (opss[i].value == result.state) {
                            opss[i].setAttribute("selected", "true");
                        } else {
                            opss[i].removeAttribute("selected");
                        }
                    }
                    $(".node-stysid").val(result.sysId);

                    daySource();

                }
            })
        })


        //插件选择时间
        laydate({
            elem: '#J-xl-1',
            choose: function () {
                daySource();
            }
        });
        laydate({
            elem: '#J-xl-2',
            choose: function () {
                daySource();
            }
        });


        // 下拉列表
        $(".drop-list").dropList();

        // 展开更多
        $(".open-list").click(function () {

            if ($(".hide-content").is(":hidden")) {
                $(".hide-content").css("display", "block");
                $(this).text("隐藏部分内容 ∧");
            } else {
                $(".hide-content").css("display", "none");
                $(this).text("展开更多信息 v");
            }
        });

        <%--确认通过不的显示或隐藏--%>
        $(".through").on("click", function () {
            $(".through-or-no-2").hide();
            $(".through-or-no-1").show();
            var lid = $(this).data("sysid"); //用户名

            $("#passY>form>input").val(lid);
        });

        $(".no-through").on("click", function () {
            $(".through-or-no-2").show();
            $(".through-or-no-1").hide();
            var lid = $(this).data("sysid"); //用户名

            $("#passN>form>input").val(lid);
        });

        //实际结束时间失去焦点事件：finish-time
        $(".finish-time").blur(function () {
            daySource();
        });

        //实际结束时间失去焦点事件：finish-time
        $(".plan-start-time").blur(function () {
            daySource();
        });

        function daySource() {
            var palnStartDate = $(".plan-start-time").val();
            var finishDate = $(".finish-time").val();
            if (palnStartDate != undefined && finishDate != undefined) {
                palnStartDate = palnStartDate.replace(/-/g, "/");
                finishDate = finishDate.replace(/-/g, "/");
                var date1 = Date.parse(palnStartDate);
                var date2 = Date.parse(finishDate);
                var factDays = Math.ceil((date2 - date1) / (24 * 60 * 60 * 1000)) + 1;

                if (factDays < 1) {
                    alert("结束时间不能早于开始时间");
                    $(".finish-time").val("");
                    return false;
                } else {
                    $(".actual-time").val(factDays);
                }

            }
        }

        //计算日期相减出去周末 （天数）
        /*  function cal() {
              var d1 = $("date1").value.split("-");
              var d2 = $("date2").value.split("-");
              var date1 = new Date(d1[0], d1[1] - 1, d1[2]);
              var date2 = new Date(d2[0], d2[1] - 1, d2[2]);
              var day = (date2.getTime() - date1.getTime()) / (1000 * 60 * 60 * 24);
              var w1 = date1.getDay();
              var w2 = date2.getDay();
              var w = parseInt(day / 7) * 2;
              w += w1 > w2 ? 2 : w1 == 0 ? 1 : 0;
              $("result").value = day - w + 1;
          }*/

        window.setTimeout(authorityFunc, 500);

        //延时加载
        function authorityFunc() {
            //管理员权限
            if (branchType == "2") {
                //显示（搜索、导出督查任务）
                $(".authority").css("display", "inline");
            }
        }

        /**
         * 企查查
         */
        $(".resptUnit").click(function () {
            var params = $(this).text();//企业名称
            var userId = "13599777146";//用户id
            var userMd5 = hex_md5(userId);
            var sign = hex_md5(userMd5 + "7d44f079e9051033d4e08626a865f2bf");
            var url = "https://link.qichacha.com/open/index.html#/search-company/59b25af198055be06d6908b4376829c8/" + sign + "/" + userMd5 + "?searchKey=" + params;
            window.open(url.replace(/\s*/g, ""));//跳转企查查页面 replae：去除参数空格问题
        });
    })

    // function joinTask(taskId){
    //
    // }
    // $("#joinTask").click(function () {
    //     var url = '/missions';
    //     //先清空条件,多次调用时查询条件会累加
    //     $('#gridTable').jqGrid('clearGridData');
    //     $("#gridTable").jqGrid('setGridParam', {
    //         url: url,
    //         datatype: 'json',
    //         postData: {'tasktimes': '2', 'messageFlag': ''}, //发送数据
    //     }).trigger("reloadGrid"); //重新载入
    // });

    function showSupervisionNode() {
        debugger
        var nodeDetail_div = $("#nodeDetail_div");


        $("#nodeDetail_div").css("display","none");
    }
</script>
</body>
</html>